package com.liukai.personalbills.task;

import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;

import com.liukai.personalbills.util.HttpUtil;

public class PostHttpTask extends AsyncTask<Void,Void,Void> {

    private Handler handler;
    private String url;
    private String data;

    public void setData(String data) {
        this.data = data;
    }

    public void setHandler(Handler handler) {
        this.handler = handler;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    protected Void doInBackground(Void... voids) {

        String result = HttpUtil.sendRequest(url,"POST");
//        String result = HttpUtil.sendPost(url,data);
        Message message = new Message();
        message.what = 0;
        message.obj = result;
        handler.sendMessage(message);

        return null;
    }
}
